
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>4.4 服务发现 · Kubernetes - 痴者工良</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="痴者工良">
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../5.volumes/" />
    
    
    <link rel="prev" href="3.ingress.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://www.whuanle.cn" target="_blank" class="custom-link">痴者工良的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    文档说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    1.基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../1.basic/1.docker.html">
            
                <a href="../1.basic/1.docker.html">
            
                    
                    1.1 说透 Docker：基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../1.basic/2.virtual.html">
            
                <a href="../1.basic/2.virtual.html">
            
                    
                    1.2 说透 Docker： 虚拟化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../1.basic/3.docker_network.html">
            
                <a href="../1.basic/3.docker_network.html">
            
                    
                    1.3 了解 Docker 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../1.basic/4.pod_docker.html">
            
                <a href="../1.basic/4.pod_docker.html">
            
                    
                    1.4 Docker 和 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../1.basic/5.k8s.html">
            
                <a href="../1.basic/5.k8s.html">
            
                    
                    1.5 K8S入门基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../2.deploy/">
            
                <a href="../2.deploy/">
            
                    
                    2.部署和配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../2.deploy/2.deploy.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../2.deploy/1.minikube.html">
            
                <a href="../2.deploy/1.minikube.html">
            
                    
                    2.1 使用 Minikube 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../2.deploy/2.kubeadm.html">
            
                <a href="../2.deploy/2.kubeadm.html">
            
                    
                    2.2 使用 kubeadm 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../2.deploy/3.kubeadm_ckad.html">
            
                <a href="../2.deploy/3.kubeadm_ckad.html">
            
                    
                    2.3 CKAD认证中的部署教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../2.deploy/4.kubeadm_proxy.html">
            
                <a href="../2.deploy/4.kubeadm_proxy.html">
            
                    
                    2.4 国内代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../2.deploy/5.dashboard.html">
            
                <a href="../2.deploy/5.dashboard.html">
            
                    
                    2.5 Dashboard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../3.pod/">
            
                <a href="../3.pod/">
            
                    
                    3.Pod部署和调度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../3.pod/">
            
                <a href="../3.pod/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../3.pod/1.pod.html">
            
                <a href="../3.pod/1.pod.html">
            
                    
                    3.1 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../3.pod/2.deployment.html">
            
                <a href="../3.pod/2.deployment.html">
            
                    
                    3.2 Deployment部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../3.pod/3.replica.html">
            
                <a href="../3.pod/3.replica.html">
            
                    
                    3.3 副本集(ReplicaSet)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../3.pod/4.pod_network.html">
            
                <a href="../3.pod/4.pod_network.html">
            
                    
                    3.34 Pod 端口映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../3.pod/5.update.html">
            
                <a href="../3.pod/5.update.html">
            
                    
                    3.5 Pod 升级、回滚
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../3.pod/6.scale.html">
            
                <a href="../3.pod/6.scale.html">
            
                    
                    3.6 Pod 缩放
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../3.pod/7.lable.html">
            
                <a href="../3.pod/7.lable.html">
            
                    
                    3.7.Pod 标签
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../3.pod/8.schedule.html">
            
                <a href="../3.pod/8.schedule.html">
            
                    
                    3.8 Pod 调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../3.pod/9.jobs_cronjobs.html">
            
                <a href="../3.pod/9.jobs_cronjobs.html">
            
                    
                    3.9 Jobs、CronJobs
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="./">
            
                <a href="./">
            
                    
                    4.Kubernetes 网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="./">
            
                <a href="./">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="1.network.html">
            
                <a href="1.network.html">
            
                    
                    4.1 Kubernetes 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="2.endpoint.html">
            
                <a href="2.endpoint.html">
            
                    
                    4.2 Endpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="3.ingress.html">
            
                <a href="3.ingress.html">
            
                    
                    4.3 ingress
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.5" data-path="4.discovery.html">
            
                <a href="4.discovery.html">
            
                    
                    4.4 服务发现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    5.volumes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../5.volumes/1.volumes.html">
            
                <a href="../5.volumes/1.volumes.html">
            
                    
                    5.1 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../5.volumes/2.secret_configmap.html">
            
                <a href="../5.volumes/2.secret_configmap.html">
            
                    
                    5.2 secret 和 ConfigMap 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../5.volumes/3.nfts.html">
            
                <a href="../5.volumes/3.nfts.html">
            
                    
                    5.3 NFS卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../5.volumes/4.pv_pvc.html">
            
                <a href="../5.volumes/4.pv_pvc.html">
            
                    
                    5.4 持久化卷
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    6.API 和 安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../7.health/">
            
                <a href="../7.health/">
            
                    
                    7.维护和故障排除
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../8.health/README.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../k8s.html">
            
                <a href="../k8s.html">
            
                    
                    Kubernetes 命令概览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../ckad.html">
            
                <a href="../ckad.html">
            
                    
                    CKAD 认证帮助
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >4.4 服务发现</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#44-&#x670D;&#x52A1;&#x53D1;&#x73B0;"><b></b>4.4 &#x670D;&#x52A1;&#x53D1;&#x73B0;</a></li><ul><li><span class="title-icon "></span><a href="#proxy"><b></b>proxy</a></li><ul><li><span class="title-icon "></span><a href="#kubectl-proxy"><b></b>kubectl proxy</a></li></ul><li><span class="title-icon "></span><a href="#&#x670D;&#x52A1;&#x53D1;&#x73B0;"><b></b>&#x670D;&#x52A1;&#x53D1;&#x73B0;</a></li><ul><li><span class="title-icon "></span><a href="#service"><b></b>Service</a></li><li><span class="title-icon "></span><a href="#&#x901A;&#x8FC7;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x53D1;&#x73B0;-service"><b></b>&#x901A;&#x8FC7;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x53D1;&#x73B0; Service</a></li><li><span class="title-icon "></span><a href="#dnscoredns"><b></b>DNS/CoreDNS</a></li></ul></ul></ul></div><h1 id="44-&#x670D;&#x52A1;&#x53D1;&#x73B0;"><a name="44-&#x670D;&#x52A1;&#x53D1;&#x73B0;" class="anchor-navigation-ex-anchor" href="#44-&#x670D;&#x52A1;&#x53D1;&#x73B0;"><i class="fa fa-link" aria-hidden="true"></i></a>4.4 &#x670D;&#x52A1;&#x53D1;&#x73B0;</h1>
<p>&#x670D;&#x52A1;&#x53D1;&#x73B0;&#x3001;&#x670D;&#x52A1;&#x6CE8;&#x518C;&#x662F;&#x5FAE;&#x670D;&#x52A1;&#x4E2D;&#x5FC5;&#x4E0D;&#x53EF;&#x5C11;&#x7684;&#x4E1C;&#x897F;&#xFF0C;Kubernetes &#x672C;&#x8EAB;&#x4E5F;&#x63D0;&#x4F9B;&#x4E86;&#x7B80;&#x5355;&#x7684;&#x670D;&#x52A1;&#x53D1;&#x73B0;&#xFF0C;&#x672C;&#x7AE0;&#x4ECB;&#x7ECD;&#x5982;&#x4F55;&#x901A;&#x8FC7; Service&#x3001;DNS &#x7B49;&#xFF0C;&#x5BF9;&#x5916;&#x66B4;&#x9732;&#x670D;&#x52A1;&#x3002;</p>
<h2 id="proxy"><a name="proxy" class="anchor-navigation-ex-anchor" href="#proxy"><i class="fa fa-link" aria-hidden="true"></i></a>proxy</h2>
<h3 id="kubectl-proxy"><a name="kubectl-proxy" class="anchor-navigation-ex-anchor" href="#kubectl-proxy"><i class="fa fa-link" aria-hidden="true"></i></a>kubectl proxy</h3>
<p>kubectl proxy &#x53EF;&#x4EE5;&#x5E2E;&#x6211;&#x4EEC;&#x6620;&#x5C04;&#x4E00;&#x4E2A;&#x7AEF;&#x53E3;&#x5230;&#x8282;&#x70B9;&#x4E2D;&#xFF0C;&#x4E3B;&#x8981;&#x7528;&#x5904;&#x662F;&#x521B;&#x5EFA;&#x7C7B;&#x4F3C; Service NodePort &#x7684;&#x8BBF;&#x95EE;&#x670D;&#x52A1;&#x3002;</p>
<p>&#x4F8B;&#x5982;  kubectl proxy &#x53EF;&#x5728; localhost &#x548C; Kubernetes API server &#x4E4B;&#x95F4;&#x521B;&#x5EFA;&#x4EE3;&#x7406;&#x670D;&#x52A1;&#x5668;&#x6216;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7EA7;&#x7F51;&#x5173;&#xFF0C;&#x65B9;&#x4FBF;&#x6211;&#x4EEC;&#x8BBF;&#x95EE; API Server&#x3002;</p>
<p>&#x6267;&#x884C;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre class="language-"><code>kubectl proxy
# &#x6216;&#x6307;&#x5B9A;&#x8BBF;&#x95EE;&#x7AEF;&#x53E3;&#xFF0C;&#x7AEF;&#x53E3;&#x9ED8;&#x8BA4;&#x4E3A; 8001
kubectl proxy --port=8001
</code></pre><p>&#x5728;&#x672C;&#x673A;&#x4E0A;&#x6267;&#x884C;&#x8BBF;&#x95EE; <code>http://127.0.0.1:8001</code> &#x5373;&#x53EF;&#x8BBF;&#x95EE; API Server&#x3002;</p>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x60F3;&#x5728;&#x5916;&#x7F51;&#x8BBF;&#x95EE; API Server&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>--address</code>&#x3002;</p>
<pre class="language-"><code>kubectl proxy --address=0.0.0.0 --port=8001
</code></pre><blockquote>
<p>&#x5982;&#x679C;&#x8981;&#x5728;&#x5916;&#x7F51;&#x8BBF;&#x95EE;&#xFF0C;&#x9700;&#x8981;&#x6DFB;&#x52A0;&#x5934;&#x90E8;&#x8BA4;&#x8BC1;&#x4FE1;&#x606F;&#xFF0C;&#x5426;&#x5219;&#x663E;&#x793A; &#x201C;Forbidden 403&#x201D;&#x3002;&#x8FD9;&#x8DDF; API Server &#x6709;&#x5173;&#xFF0C;&#x5982;&#x679C;&#x8981;&#x6620;&#x5C04;&#x522B;&#x7684;&#x670D;&#x52A1;&#xFF0C;&#x5219;&#x4E0D;&#x9700;&#x8981;&#x8FD9;&#x6837;&#x3002;</p>
</blockquote>
<p><img src="images/find1.jpg" alt="find1"></p>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x60F3;&#x5141;&#x8BB8;&#x6240;&#x6709; IP &#x8BBF;&#x95EE;&#xFF0C;&#x53C8;&#x4E0D;&#x9700;&#x8981;&#x8BA4;&#x8BC1;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#xFF1A;</p>
<pre class="language-"><code>kubectl proxy --address=&apos;0.0.0.0&apos;  --accept-hosts=&apos;^*$&apos;
</code></pre><p>&#x53EF;&#x4EE5;&#x5229;&#x7528;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x4E3A; Api Server &#x66B4;&#x9732;&#x516C;&#x7F51;&#x670D;&#x52A1;&#xFF0C;&#x7136;&#x540E;&#x4F7F;&#x7528; <code>kubeadm join</code> &#x901A;&#x8FC7;&#x516C;&#x7F51; IP &#x5C06;&#x8282;&#x70B9;&#x52A0;&#x5165;&#x5230;&#x96C6;&#x7FA4;&#x4E2D;&#x3002;</p>
<p><img src="images/find2.jpg" alt="find2"></p>
<h2 id="&#x670D;&#x52A1;&#x53D1;&#x73B0;"><a name="&#x670D;&#x52A1;&#x53D1;&#x73B0;" class="anchor-navigation-ex-anchor" href="#&#x670D;&#x52A1;&#x53D1;&#x73B0;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x670D;&#x52A1;&#x53D1;&#x73B0;</h2>
<h3 id="service"><a name="service" class="anchor-navigation-ex-anchor" href="#service"><i class="fa fa-link" aria-hidden="true"></i></a>Service</h3>
<p>&#x5229;&#x7528;&#x5E38;&#x89C4;&#x7684; Service&#x3001;Endpoint &#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x505A;&#x670D;&#x52A1;&#x53D1;&#x73B0;&#xFF0C;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x77E5;&#x9053;&#x4E00;&#x4E2A; &#x56FA;&#x5B9A;&#x7684; IP &#x5373;&#x53EF;&#xFF0C;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x5173;&#x5FC3;&#x80CC;&#x540E;&#x662F;&#x8C01;&#x5728;&#x63D0;&#x4F9B;&#x670D;&#x52A1;&#x3002;&#x901A;&#x8FC7;&#x521B;&#x5EFA; Service&#xFF0C;&#x53EF;&#x4EE5;&#x83B7;&#x53D6;&#x4E00;&#x4E2A;&#x5355;&#x4E00;&#x7684;&#x7A33;&#x5B9A;&#x7684; IP&#xFF0C;&#x53EA;&#x8981; Service &#x5B58;&#x5728;&#xFF0C;&#x5176; IP &#x4FBF;&#x4E0D;&#x4F1A;&#x53D8;&#x5316;&#xFF0C;&#x5176;&#x80CC;&#x540E;&#x7684; Pod &#x53EF;&#x80FD;&#x589E;&#x52A0;&#x6216;&#x51CF;&#x5C11;&#xFF0C;&#x4F46;&#x59CB;&#x7EC8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x56FA;&#x5B9A;&#x7684; Service IP &#x8FDB;&#x884C;&#x8BBF;&#x95EE;&#x3002;</p>
<p>&#x4E00;&#x822C;&#xFF0C;&#x6211;&#x4EEC;&#x521B;&#x5EFA; Service&#xFF0C;&#x7136;&#x540E;&#x83B7;&#x5F97; Cluster IP&#xFF0C;&#x63A5;&#x7740;&#x5C06; IP &#x5199;&#x5165;&#x7A0B;&#x5E8F;&#x7684;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E2D;&#x3002;&#x5728;&#x4E0B;&#x9762;&#x8FD9;&#x4E2A; Service &#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x80FD;&#x591F;&#x83B7;&#x5F97;&#x5176;&#x7684; Cluster IP &#x548C; &#x66B4;&#x9732;&#x7684; 8080 &#x7AEF;&#x53E3;&#x3002;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">labels</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> web1
  <span class="token key atrule">name</span><span class="token punctuation">:</span> web1
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">clusterIP</span><span class="token punctuation">:</span> 10.104.102.51
  <span class="token key atrule">ports</span><span class="token punctuation">:</span>
    <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8080</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> web1
</code></pre>
<p>&#x4F46;&#x662F;&#x8FD9;&#x6837;&#x6709;&#x4E2A;&#x7F3A;&#x70B9;&#xFF0C;&#x9700;&#x8981;&#x63D0;&#x524D;&#x5C06; IP &#x5199;&#x5230;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E2D;&#x3002;</p>
<p>&#x5728; <a href="../1.basic/2.containerized.md">1.2&#x7AE0; &#x7684; &#x5BB9;&#x5668;&#x5316;&#x5E94;&#x7528;</a> &#x4E2D;&#xFF0C;&#x4ECB;&#x7ECD;&#x4E86;&#x4E00;&#x4E2A;&#x5BB9;&#x5668;&#x5316;&#x5E94;&#x7528;&#x5E94;&#x5F53;&#x9075;&#x4ECE;&#x54EA;&#x4E9B;&#x8BBE;&#x8BA1;&#x539F;&#x5219;&#xFF0C;&#x5BF9;&#x4E8E;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x7684;&#x8FDC;&#x7A0B;&#x670D;&#x52A1;&#xFF0C;&#x5728;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E2D;&#x63D0;&#x524D;&#x914D;&#x7F6E; IP &#xFF0C;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x597D;&#x505A;&#x6CD5;&#x3002;&#x5982;&#x679C; IP &#x901A;&#x8FC7;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x8BB0;&#x5F55;&#xFF0C;&#x90A3;&#x4E48;&#x4E00;&#x65E6;&#x6253;&#x5305;&#x597D;&#x955C;&#x50CF;&#xFF0C;&#x5176;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x65E0;&#x6CD5;&#x518D;&#x6539;&#x53D8;&#xFF0C;&#x9664;&#x975E;&#x66F4;&#x65B0;&#x7248;&#x672C;&#xFF0C;&#x96BE;&#x9053;&#x8981;&#x4E3A;&#x4E86;&#x4E00;&#x4E2A;&#x914D;&#x7F6E;&#x9879;&#xFF0C;&#x66F4;&#x65B0;&#x7A0B;&#x5E8F;&#x7248;&#x672C;&#xFF1F;&#x6216;&#x8005;&#x624B;&#x52A8;&#x8FDB;&#x5165;&#x5BB9;&#x5668;&#x4E2D;&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x8FD9;&#x6837;&#x6BCF;&#x4E2A; Pod &#x90FD;&#x8981;&#x624B;&#x5DE5;&#x8FDB;&#x5165;&#x5BB9;&#x5668;&#xFF0C;&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#x6587;&#x4EF6;(&#x8FD9;&#x662F;&#x4E00;&#x79CD;&#x6781;&#x5176;&#x611A;&#x8822;&#x7684;&#x505A;&#x6CD5;&#xFF0C;&#x4F8B;&#x5982;&#x6211;&#x4E0A;&#x5BB6;&#x516C;&#x53F8;)&#x3002;</p>
<p>&#x5728; 4.2 Endpoint &#x4E00;&#x7AE0;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x5B66;&#x4F1A;&#x4E86;&#x5982;&#x4F55;&#x89E3;&#x8026; Service &#x8DDF; Endpoint&#x3001;Pod&#xFF0C;&#x5728;&#x8FD9;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x5C06;&#x5229;&#x7528;&#x8FD9;&#x4E2A;&#x89E3;&#x8026;&#xFF0C;&#x5B9E;&#x73B0;&#x7B80;&#x5355;&#x7684;&#x670D;&#x52A1;&#x53D1;&#x73B0;&#x3002;</p>
<h3 id="&#x901A;&#x8FC7;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x53D1;&#x73B0;-service"><a name="&#x901A;&#x8FC7;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x53D1;&#x73B0;-service" class="anchor-navigation-ex-anchor" href="#&#x901A;&#x8FC7;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x53D1;&#x73B0;-service"><i class="fa fa-link" aria-hidden="true"></i></a>&#x901A;&#x8FC7;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x53D1;&#x73B0; Service</h3>
<p>&#x6211;&#x4EEC;&#x6709;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x540D;&#x4E3A; my-app&#xFF0C;&#x9700;&#x8981;&#x8BBF;&#x95EE; mysql &#x670D;&#x52A1;&#xFF0C;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x8BE5;&#x5982;&#x4F55;&#x4E3A; my-app &#x914D;&#x7F6E; mysql &#x670D;&#x52A1;&#x7684; IP &#x5730;&#x5740;&#xFF1F;</p>
<p>&#x521B;&#x5EFA; Deployment&#xFF0C;&#x90E8;&#x7F72;&#x4E24;&#x4E2A;&#x5E94;&#x7528;&#x3002;</p>
<pre class="language-"><code class="lang-bash">kubectl create deployment my-app --image<span class="token operator">=</span>nginx:latest --replicas<span class="token operator">=</span><span class="token number">1</span>
kubectl create deployment mysql  --image<span class="token operator">=</span>mysql:latest --replicas<span class="token operator">=</span><span class="token number">1</span>
</code></pre>
<p>&#x521B;&#x5EFA; Service&#xFF0C;&#x4E3A;&#x4E24;&#x4E2A;&#x5E94;&#x7528;&#x66B4;&#x9732;&#x7AEF;&#x53E3;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">kubectl expose deployment my-app --port<span class="token operator">=</span><span class="token number">6666</span> --target-port<span class="token operator">=</span><span class="token number">80</span>
kubectl expose deployment mysql  --port<span class="token operator">=</span><span class="token number">3306</span> --target-port<span class="token operator">=</span><span class="token number">3306</span>
</code></pre>
<p>&#x83B7;&#x53D6; Service &#x5217;&#x8868;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">root@instance-2:~<span class="token comment"># kubectl get services</span>
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT<span class="token punctuation">(</span>S<span class="token punctuation">)</span>          AGE
my-app       ClusterIP   <span class="token number">10.109</span>.136.115   <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>        <span class="token number">6666</span>/TCP         4m16s
mysql        ClusterIP   <span class="token number">10.97</span>.129.201    <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>        <span class="token number">3306</span>/TCP         7s
</code></pre>
<p>&#x7531;&#x4E8E;&#x5728;&#x521B;&#x5EFA; Service &#x4E4B;&#x524D;&#xFF0C;&#x5DF2;&#x7ECF;&#x5B58;&#x5728; Pod&#xFF0C;&#x8FD9;&#x4E2A; Pod &#x4E2D;&#x4E0D;&#x4F1A;&#x6709; Service &#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5148;&#x5220;&#x9664;&#x8FD9;&#x4E2A;&#x65E7;&#x7684; Pod&#x3002;</p>
<p>&#x83B7;&#x53D6; Pod &#x5217;&#x8868;&#xFF0C;&#x5E76;&#x5220;&#x9664;&#x7531; my-app &#x521B;&#x5EFA;&#x7684; Pod&#x3002;</p>
<pre class="language-"><code class="lang-bash">root@instance-2:~<span class="token comment"># kubectl get pods</span>
NAME                     READY   STATUS    RESTARTS   AGE
my-app-d57587579-glh22   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          37s

root@instance-2:~<span class="token comment"># kubectl delete pod my-app-d57587579-glh22</span>
pod <span class="token string">&quot;my-app-d57587579-glh22&quot;</span> deleted
</code></pre>
<p>&#x63A5;&#x7740;&#xFF0C;ReplicaSet &#x4F1A;&#x6211;&#x6211;&#x4EEC;&#x91CD;&#x65B0;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; Pod&#xFF0C;&#x6211;&#x4EEC;&#x67E5;&#x770B;&#x8FD9;&#x4E2A; Pod &#x7684;&#x540D;&#x79F0;&#xFF0C;&#x7136;&#x540E;&#x8FDB;&#x5165; Pod &#x4E2D;&#x7684;&#x5BB9;&#x5668;&#x6267;&#x884C;&#x547D;&#x4EE4;&#x3002;</p>
<pre class="language-"><code class="lang-bash">kubectl <span class="token builtin class-name">exec</span> my-app-d57587579-rdsf7 my-app -- <span class="token function">env</span>
</code></pre>
<pre class="language-"><code>HOSTNAME=my-app-d57587579-wt5s8
MY_APP_SERVICE_HOST=10.109.136.115
MY_APP_SERVICE_PORT=6666

MYSQL_SERVICE_HOST=10.97.129.201
MYSQL_SERVICE_PORT=3306
</code></pre><blockquote>
<p>&#x6240;&#x6709;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x540D;&#x4E3A;&#x5927;&#x5199;&#x5B57;&#x6BCD;&#xFF0C;&#x540D;&#x79F0;&#x4E0D;&#x652F;&#x6301;&#x7279;&#x6B8A;&#x7B26;&#x53F7;&#xFF0C;&#x4F8B;&#x5982; <code>my-app</code> &#x4F1A;&#x88AB;&#x8F6C;&#x4E3A; <code>MY_APP</code>&#x3002;</p>
</blockquote>
<p>&#x5728; <code>*_SERVICE_HOST</code> &#x548C; <code>*_SERVICE_PORT</code> &#x4E2D;&#xFF0C;&#x4FDD;&#x5B58;&#x6709; &#x96C6;&#x7FA4;&#x4E2D;&#x6240;&#x6709; Service &#x7684; IP&#xFF0C;&#x5728; my-app &#x7684; Pod &#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <code>MYSQL_SERVICE_HOST</code> &#x73AF;&#x5883;&#x53D8;&#x91CF;&#x83B7;&#x53D6; mysql &#x670D;&#x52A1;&#x7684; IP &#x5730;&#x5740;&#xFF0C;&#x8FD9;&#x4FBF;&#x662F;&#x4E00;&#x79CD;&#x670D;&#x52A1;&#x53D1;&#x73B0;&#x3002;</p>
<p>&#x5728; Pod &#x4E2D;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; env &#x547D;&#x4EE4;&#x67E5;&#x770B;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF0C;&#x91CC;&#x9762;&#x6709;&#x5F53;&#x524D;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x7684; Service &#x4FE1;&#x606F;&#x3002;</p>
<p><img src="images/env.jpg" alt="env"></p>
<h3 id="dnscoredns"><a name="dnscoredns" class="anchor-navigation-ex-anchor" href="#dnscoredns"><i class="fa fa-link" aria-hidden="true"></i></a>DNS/CoreDNS</h3>
<p>&#x5728; kube-system &#x4E2D;&#xFF0C;&#x8FD0;&#x884C;&#x7740;&#x4E00;&#x4E2A; DNS &#x670D;&#x52A1;&#x5668;&#xFF0C;&#x5176;&#x540D;&#x79F0;&#x4E3A; coredns&#xFF0C;&#x5728; Kubernetes &#x4E2D;&#xFF0C;&#x6BCF;&#x4E2A; Service &#x90FD;&#x4F1A;&#x88AB;&#x8D4B;&#x4E88;&#x4E00;&#x4E2A; DNS &#x540D;&#x79F0;(&#x5C31;&#x50CF;&#x57DF;&#x540D;)&#xFF0C;&#x6BCF;&#x5F53;&#x6709;&#x65B0;&#x589E;&#x7684; Service &#x65F6;&#xFF0C;coredns &#x4FBF;&#x4F1A;&#x4E3A;&#x6B64; Service &#x6DFB;&#x52A0; DNS &#x8BB0;&#x5F55;&#x3002;</p>
<pre class="language-"><code class="lang-bash">kubectl get deployment  -n kube-system
</code></pre>
<pre class="language-"><code class="lang-bash">NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
calico-kube-controllers   <span class="token number">1</span>/1     <span class="token number">1</span>            <span class="token number">1</span>           13d
coredns                   <span class="token number">2</span>/2     <span class="token number">2</span>            <span class="token number">2</span>           13d
</code></pre>
<p>&#x7EE7;&#x7EED;&#x4E0A;&#x4E00;&#x4E2A;&#x5C0F;&#x8282;&#x4E2D;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x6211;&#x4EEC;&#x90E8;&#x7F72;&#x4E86; my-app &#x548C; mysql&#xFF0C;&#x6211;&#x4EEC;&#x67E5;&#x770B;&#x8FD9;&#x4E24;&#x4E2A; Service &#x7684; DNS &#x540D;&#x79F0;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token function">nslookup</span> my-app.default
<span class="token function">nslookup</span> mysql.default
</code></pre>
<blockquote>
<p>&#x3002;&#x5C31;&#x50CF;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E00;&#x6837;&#xFF0C;&#x6BCF;&#x4E2A; Pod &#x4E2D;&#x7684; <code>/etc/resolv.conf</code> &#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x4E5F;&#x4F1A;&#x4FDD;&#x5B58;&#x6240;&#x6709; Service &#x7684; DNS &#x540D;&#x79F0;&#x3002;</p>
<p>&#x6267;&#x884C;&#x547D;&#x4EE4;&#x67E5;&#x8BE2; DNS &#x5217;&#x8868;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">kubectl <span class="token builtin class-name">exec</span> my-app-d57587579-rdsf7 my-app -- <span class="token function">cat</span> /etc/resolv.conf
</code></pre>
<p>&#x4E0D;&#x8FC7;&#xFF0C;Pod &#x4E2D;&#x7684; <code>/etc/resolv.conf</code> &#x53EA;&#x80FD;&#x770B;&#x5230;&#x76F8;&#x540C;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x4E0B;&#x7684;&#x5176;&#x5B83; Service&#x3002;</p>
</blockquote>
<p>&#x6309;&#x7167;&#x5B98;&#x7F51;&#x6587;&#x6863;&#xFF0C;&#x5982;&#x679C;&#x6B63;&#x5E38;&#x7684;&#x8BDD;&#xFF0C;&#x67E5;&#x8BE2;&#x7ED3;&#x679C;&#x7C7B;&#x4F3C;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">Server:    <span class="token number">10.0</span>.0.10
Address <span class="token number">1</span>: <span class="token number">10.0</span>.0.10

Name:      kubernetes.default
Address <span class="token number">1</span>: <span class="token number">10.0</span>.0.1
</code></pre>
<p>&#x5982;&#x679C;&#x8F93;&#x51FA;&#x8DDF;&#x7B14;&#x8005;&#x7684;&#x4E00;&#x6837;&#xFF0C;&#x63D0;&#x793A; <code>server can&apos;t find my-app.default: NXDOMAIN</code>&#xFF0C;&#x8BF4;&#x660E; coredns &#x6709;&#x95EE;&#x9898;&#x3002;</p>
<pre class="language-"><code class="lang-bash">root@instance-2:~<span class="token comment"># nslookup my-app.default</span>
Server:        <span class="token number">127.0</span>.0.53
Address:    <span class="token number">127.0</span>.0.53<span class="token comment">#53</span>

** server can<span class="token string">&apos;t find my-app.default: NXDOMAIN

root@instance-2:~# nslookup mysql.default
Server:        127.0.0.53
Address:    127.0.0.53#53

** server can&apos;</span>t <span class="token function">find</span> mysql.default: NXDOMAIN
</code></pre>
<p>&#x7531;&#x4E8E;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x5F88;&#x9EBB;&#x70E6;&#xFF0C;&#x7B14;&#x8005;&#x6682;&#x65F6;&#x6CA1;&#x80FD;&#x89E3;&#x51B3;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;&#x56E0;&#x6B64;&#x8FD9;&#x91CC;&#x5C31;&#x4E0D;&#x518D;&#x8BB2;&#x8FF0;&#x4E86;&#xFF0C;&#x8BFB;&#x8005;&#x53EF;&#x81EA;&#x884C;&#x53C2;&#x8003;&#x8D44;&#x6599;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x3002;</p>
<p><a href="https://github.com/kubernetes/dns/blob/master/docs/specification.md" target="_blank">https://github.com/kubernetes/dns/blob/master/docs/specification.md</a></p>
<p><a href="https://kubernetes.io/zh/docs/tasks/administer-cluster/dns-debugging-resolution/" target="_blank">https://kubernetes.io/zh/docs/tasks/administer-cluster/dns-debugging-resolution/</a></p>
<p><a href="https://github.com/aws/containers-roadmap/issues/1115" target="_blank">https://github.com/aws/containers-roadmap/issues/1115</a></p>
<p><a href="https://github.com/coredns/deployment/blob/master/kubernetes/Upgrading_CoreDNS.md" target="_blank">https://github.com/coredns/deployment/blob/master/kubernetes/Upgrading_CoreDNS.md</a></p>
<blockquote>
<p>&#x901A;&#x8FC7; Headless &#x53D1;&#x73B0;&#x670D;&#x52A1;&#xFF0C;&#x4E5F;&#x662F;&#x4F7F;&#x7528;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x3002;</p>
</blockquote>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x75F4;&#x8005;&#x5DE5;&#x826F; 2021 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x6587;&#x6863;&#x6700;&#x540E;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2021-11-17 07:19:43
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="3.ingress.html" class="navigation navigation-prev " aria-label="Previous page: 4.3 ingress">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../5.volumes/" class="navigation navigation-next " aria-label="Next page: 5.volumes">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"4.4 服务发现","level":"1.5.5","depth":2,"next":{"title":"5.volumes","level":"1.6","depth":1,"path":"5.volumes/README.md","ref":"5.volumes/README.md","articles":[{"title":"导读","level":"1.6.1","depth":2,"path":"5.volumes/README.md","ref":"5.volumes/README.md","articles":[]},{"title":"5.1 卷","level":"1.6.2","depth":2,"path":"5.volumes/1.volumes.md","ref":"5.volumes/1.volumes.md","articles":[]},{"title":"5.2 secret 和 ConfigMap 卷","level":"1.6.3","depth":2,"path":"5.volumes/2.secret_configmap.md","ref":"5.volumes/2.secret_configmap.md","articles":[]},{"title":"5.3 NFS卷","level":"1.6.4","depth":2,"path":"5.volumes/3.nfts.md","ref":"5.volumes/3.nfts.md","articles":[]},{"title":"5.4 持久化卷","level":"1.6.5","depth":2,"path":"5.volumes/4.pv_pvc.md","ref":"5.volumes/4.pv_pvc.md","articles":[]}]},"previous":{"title":"4.3 ingress","level":"1.5.4","depth":2,"path":"4.network/3.ingress.md","ref":"4.network/3.ingress.md","articles":[]},"dir":"ltr"},"config":{"plugins":["tbfed-pagefooter","anchor-navigation-ex","mermaid-gb3","insert-logo","chapter-fold","advanced-emoji","github","splitter","alerts","popup","prism","-highlight","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 痴者工良 2021","modify_label":"文档最后更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"prism":{"lang":{"flow":"typescript","shell":"bash"},"ignore":["mermaid","eval-js"],"css":["prismjs/themes/prism.css"],"js":["prismjs/prism.js","prismjs/components.js","prismjs/components/prism-go.min.js","prismjs/components/prism-yaml.min.js","prismjs/components/prism-bash.min.js","prismjs/components/prism-shell-session.min.js"]},"github":{"url":"https://github.com/whuanle/kubernetes"},"livereload":{},"splitter":{},"search":{},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"alerts":{},"advanced-emoji":{"embedEmojis":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"insert-logo":{"style":"background: none; max-height: 50px; min-height: 50px","url":"/images/logo.jpg"}},"theme":"default","author":"痴者工良","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Kubernetes - 痴者工良","language":"zh-hans","links":{"sidebar":{"痴者工良的博客":"https://www.whuanle.cn"}},"gitbook":"*","description":"这是一本关于 Kubernetes 的书，作者 痴者工良"},"file":{"path":"4.network/4.discovery.md","mtime":"2021-11-16T23:19:43.590Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-11-16T23:21:22.294Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

